<?php

  session_start();
  include "config.php";
  include "ALcustomerEnquiryProblem.php";

  if(isset($_SESSION["user"]))
  {
	  include "$header";
	  include "$body";
  
?>

<div style="position:absolute; top:0px; left:1px; border:0;">
  <span class="prevPage">Record Customer Enquiry Problem > </span>
  <span class="page">Confirm Details</span>
</div>
  
<?php

      include "$H_rcep";

      $staff_no = $_SESSION["rcep_staff_no"];
      $enquiry_date = $_SESSION["rcep_enquiry_date"];
      $prod_no = $_SESSION["rcep_prod_no"];
      $description = $_SESSION["rcep_description"];
      $quantity = $_SESSION["rcep_quantity"];
	  $reason = $_SESSION["rcep_reason"];
      $dep_no = $_SESSION["rcep_dep_no"];
      $customer_name = $_SESSION["rcep_customer_name"];
      $customer_no = $_SESSION["rcep_customer_no"];

      if(isset($_GET["yes"]))
      {
        if(recordProblem($staff_no, $enquiry_date, $prod_no, $description, $quantity, $reason, $dep_no, $customer_name, 
        $customer_no) == false)
        {
          showForm();
          echo "<SCRIPT language='Javascript'>\n";
          echo "  recordCustomerEnquiryProblem.staff_no.value='" . $staff_no . "';\n";
          echo "  recordCustomerEnquiryProblem.enquiry_date.value='" . $enquiry_date . "';\n";
          echo "  recordCustomerEnquiryProblem.prod_no.value='" . $prod_no . "';\n";
          echo "  recordCustomerEnquiryProblem.description.value='" . $description . "';\n";
          echo "  recordCustomerEnquiryProblem.quantity.value='" . $quantity . "';\n";
          echo "  recordCustomerEnquiryProblem.reason.options[0] = new Option('" . $reason . "', '" . $reason . "');\n";
          echo "  recordCustomerEnquiryProblem.dep_no.options[0] = new Option('" . $dep_no . "', '" . $dep_no . "');\n";
          echo "  recordCustomerEnquiryProblem.customer_name.value='" . $customer_name . "';\n";
          echo "  recordCustomerEnquiryProblem.customer_no.value='" . $customer_no . "';\n";
          echo "  alert('The details could not be added.  Please try again.');";
          echo "</SCRIPT>";
        }
        else
        {
          $_SESSION["rcep_success"] = "true";
          echo "<SCRIPT language='Javascript'>";
          echo "  window.location.href = 'recordCustomerEnquiryProblem_2success.php';";
          echo "</SCRIPT>";
        }
      }
	  else if(isset($_GET["no"]))
      {
          echo "<SCRIPT language='Javascript'>";
          echo "  window.location.href = 'recordCustomerEnquiryProblem.php'";
          echo "</SCRIPT>";
      }
      else
      {
        showForm();
        echo "<SCRIPT language='Javascript'>\n";
        echo "  recordCustomerEnquiryProblem.staff_no.value='" . $staff_no . "';\n";
        echo "  recordCustomerEnquiryProblem.enquiry_date.value='" . $enquiry_date . "';\n";
        echo "  recordCustomerEnquiryProblem.prod_no.value='" . $prod_no . "';\n";
        echo "  recordCustomerEnquiryProblem.description.value='" . $description . "';\n";
        echo "  recordCustomerEnquiryProblem.quantity.value='" . $quantity . "';\n";
        echo "  recordCustomerEnquiryProblem.reason.options[0] = new Option('" . $reason . "', '" . $reason . "');\n";
        echo "  recordCustomerEnquiryProblem.dep_no.options[0] = new Option('" . $dep_no . "', '" . $dep_no . "');\n";
        echo "  recordCustomerEnquiryProblem.customer_name.value='" . $customer_name . "';\n";
        echo "  recordCustomerEnquiryProblem.customer_no.value='" . $customer_no . "';\n";
        echo "</SCRIPT>";
      }
    }
	else
    {
      echo "<SCRIPT language='Javascript'>";
      echo "  window.location.href = 'recordCustomerEnquiryProblem.php';";
      echo "</SCRIPT>";
    }
    include "$footer";
  }
  else
  {
    session_destroy();
    echo "<SCRIPT language='Javascript'>";
    echo "  parent.window.location.href = 'index.php';";
    echo "</SCRIPT>";
  }

  function showForm()
  {


?>

<b>CONFIRMATION: ARE THESE DETAILS ACCURATE?</b>

<p>

<FORM name="recordCustomerEnquiryProblem" action="" method="post">
<TABLE class="recordCustomerEnquiryProblem" cellspacing="5" cellpadding="5">
  <TR>
    <TD class="rcepField">
	  Product Number<font color="red">*</font>
	</TD>
    <TD class="rcepDetails">
	  <input type="text" class="recordCustomerEnquiryProblemConfirm" name="prod_no" style="width:150px;" readonly />
	</TD>
  </TR>
  <TR>
    <TD class="rcepField">
	  Item Description<font color="red">*</font>
	</TD>
	<TD class="rcepDetails">
	  <input type="text" class="recordCustomerEnquiryProblemConfirm" name="description" style="width:150px" readonly />
	</TD>
  </TR>
  <TR>
    <TD class="rcepField">
	  Reason for Non-supply<font color="red">*</font>
	</TD>
    <TD class="rcepDetails">
	  <select class="recordCustomerEnquiryProblemConfirm" name="reason" style="width:150px;">
	  </select>
	</TD>
  </TR>
  <TR>
    <TD class="rcepField">
	  Department<font color="red">*</font>
	</TD>
    <TD class="rcepDetails">
	  <select class="recordCustomerEnquiryProblemConfirm" name="dep_no" style="width:150px;">
	  </select>
	</TD>
  </TR>
  <TR>
    <TD class="rcepField">
	  Customer Details Supplied<font color="red">*</font>
	</TD>
    <TD class="rcepDetails">
	  <select class="recordCustomerEnquiryProblemConfirm" name="customer_details_supplied" style="width:70px;">
	  </select>
	</TD>
  </TR>
  <TR>
    <TD class="rcepField">
	  Registered Customer Name<font color="red">*</font>
	</TD>
    <TD class="rcepDetails">
	  <input type="text" class="recordCustomerEnquiryProblemConfirm" name="customer_name" style="width:150px" readonly />
	</TD>
    <TD class="rcepField">
	  or I.D.<font color="red">*</font>
	</TD>
    <TD class="rcepDetails">
	  <input type="text" class="recordCustomerEnquiryProblemConfirm" name="customer_no" style="width:150px" readonly />
	</TD>
  </TR>
  <TR>
    <TD class="rcepField">
	  Other:
	</TD>
  </TR>
  <TR>
    <TD class="rcepField">
	  Name
	</TD>
	<TD class="rcepDetails">
	  <input type="text" class="recordCustomerEnquiryProblemConfirm" name="customer_name" style="width:150px" readonly />
	</TD>
  </TR>
  <TR>
    <TD class="rcepField">
	  Address
	</TD>
	<TD class="rcepDetails">
	  <input type="text" class="recordCustomerEnquiryProblem" name="address" style="width:150px" readonly />
	</TD>
  </TR>
  <TR>
    <TD class="rcepField">
	  Form completed by:
	</TD>
  </TR>
    <TR>
    <TD class="rcepField">
	  Staff Member I.D.<font color="red">*</font>
	</TD>
	<TD class="rcepDetails">
	  <input type="text" class="recordCustomerEnquiryProblemConfirm" name="staff_no" style="width:150px" readonly />
	</TD>
  </TR>
  <TR>
    <TD class="rcepField">
	  Date
	</TD>
	<TD class="rcepDetails">
// ***NEEDS CODE*** 
	</TD>
  </TR>
</TABLE>


<p>

<input class="submit_off" type="submit" value="No" name="no" onmouseover="className='submit_on'" onmouseout="className='submit_off'" />
&nbsp;&nbsp;
<input class="submit_off" type="submit" value="Yes" name="yes" onmouseover="className='submit_on'" onmouseout="className='submit_off'" />

</FORM>

</CENTER>

</BODY>

<?php

  }
  
?>